package org.patterns.structural.flyweight.simple;


public class Client {
    public static void main(String[] args) {
        //获取享元工厂对象
        IgoChessmanFactory factory = IgoChessmanFactory.getInstance();

        //通过享元工厂获取三颗黑子
        IgoChessman black1 = factory.getIgoChessman("black");
        IgoChessman black2 = factory.getIgoChessman("black");
        IgoChessman black3 = factory.getIgoChessman("black");
        System.out.println("判断两颗黑子是否相同：" + (black1 == black2));

        //通过享元工厂获取两颗白子
        IgoChessman white1 = factory.getIgoChessman("white");
        IgoChessman white2 = factory.getIgoChessman("white");
        System.out.println("判断两颗白子是否相同：" + (white1 == white2));

        //显示棋子
        black1.display();
        black2.display();
        black3.display();
        white1.display();
        white2.display();
    }
}